package gdut.imis.controller;

import gdut.imis.Utils.Result;
import gdut.imis.domain.ClassCommittee;
import gdut.imis.service.ClassCommitteeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 14:16
 */
@RestController
@RequestMapping("/class-committee")
@Api(value = "班委档案", tags = {"班委档案"})
@RequiredArgsConstructor
public class ClassCommitteeController extends BaseController {
    private final ClassCommitteeService classCommitteeService;

    @ApiOperation("新增班委档案")
    @PostMapping("/addClassCommittee")
    @PreAuthorize("@cp.hasPermission('classCommittee')")
    public Result addClassCommittee(@RequestBody ClassCommittee classCommittee) {
        return classCommitteeService.addClassCommittee(classCommittee);
    }

    @ApiOperation("根据学生id查询学生班委档案回忆录")
    @GetMapping("/getClassCommitteMemoryByStuId/{studentId}")
    public Result getClassCommitteMemoryByStuId(@PathVariable("studentId") Long studentId){
        return classCommitteeService.getClassCommitteMemoryByStuId(studentId);
    }

}
